<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
     <!--  手机适配 -->
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/bootstrap.css" />
    <%-- <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/bootstrap/css/bootstrap-table.min.css" /> --%>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/theme/style.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/theme/bootstrap.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap/bootstrap-table.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap/bootstrap-table-locale-all.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/layerui/layer.ext.js"></script>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
</head>
<body>
  <label style="font-size:20px;">  当前房卡余额：${totalCard} 张 </label>
<form class="form-inline definewidth m20" action="index.html" method="get">  
    玩家ID：
    <input type="text" name="gameId" id="gameId"class="abc input-default"  value="">&nbsp;&nbsp;  
    <button type="button" onclick="query()" class="btn btn-primary">查询</button>
   
</form>
 <table id="mytab" class="table table-striped table-bordered"></table> 
</body>
<script>
	
	function query() {
	    var gameId = $('#gameId').val();
	    $('#mytab').bootstrapTable("refreshOptions", {
	        queryParams: function (params) {
	            params.numPerPage = params.limit;
	            params.pageNum = params.offset / params.limit + 1;
	            params.gameId = gameId;
	            return params;
	        }
	    });
	    $('#mytab').bootstrapTable({
	        url: "${pageContext.request.contextPath}/admin/card_list_data.html", //数据源
	       // height:tableHeight(),
	        dataField: "rows", //服务端返回数据键值 就是说记录放的键值是rows，分页时使用总记录数的键值为total
	        pagination: true, //是否分页
	        pageSize: 20, //单页记录数
	        pageList : [ 20,50,100,200 ],//分页步进值
	        sidePagination: "server", //服务端分页
	        contentType: "application/x-www-form-urlencoded", //请求数据内容格式 默认是 application/json 自己根据格式自行服务端处理
	        dataType: "json", //期待返回数据类型
	        method: "post", //请求方式
	        searchAlign: "left", //查询框对齐方式
	        locale: "zh-CN",
	        queryParams: function (params) {
	                params.numPerPage = params.limit;
	                params.pageNum = params.offset / params.limit + 1;
	                params.gameId = gameId;
	                return params;
	            },
	            buttonsAlign: "left", //按钮对齐方式
	        columns: [{
	        	width: "5%",
	            field: "userId",
	            title: "<input type='checkbox' onclick='selectAll()' id='controlAll'/>",
	            formatter: function (value, row, index) {
	                return '<input type="checkbox" name="roleId" value="' + value + '"/>';
	            }
	        },{
	        	width: "10%",
				field: '',
				title: '序号',
				formatter: function (value, row, index) {
					return index+1;
				}
			}, {
	            field: "gameId",
	            title: "玩家ID",
	        }, {
	            field: "nickName",
	            title: "玩家昵称",
	        },{
	            field: "insureScore",
	            title: "剩余房卡",
	        },{
	        	width: "15%",
	            field: "gameId",
	            title: "操作",
	            formatter: function (value, row, index) {
	                return '<a href="javascript:;" onclick="addwind('+value+')" >充卡</a>';
	            }
	        }]
	    }).on("click-row.bs.table", function (args, row, $element) {
	        
    });}
	

    $(function () {
    	//query()
    	
    });
	
    
    function addwind(gameId){
    	var system ={}; 
        var p = navigator.platform;      
        system.win = p.indexOf("Win") == 0; 
        system.mac = p.indexOf("Mac") == 0; 
        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);    
        if(system.win||system.mac||system.xll){
    		//如果是电脑跳转到弹出框 
        	lindex = layer.open({
      	      type: 2,
      	      title: '加卡',
      	      shadeClose: true,
      	      shade: false,
      	      maxmin: true, //开启最大化最小化按钮
      	      area: ['550px', '475px'],
      	      content: '${pageContext.request.contextPath}/admin/card_add.html?gameId='+gameId
      	    });
        }else{  
    		//如果是手机,跳转到页签
    		window.location.href="${pageContext.request.contextPath}/admin/card_add.html?gameId="+gameId;
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
	
</script>
</html>